function init(){
    setDatePicker();
	submitUpdateForm('#btn-add-user', evtAfterAddUser);
	resetUserPassword();
	changeUserState();
}

function evtAfterAddUser(data){}

function resetUserPassword(){
	$('a.btn-reset-pass').click(function(e){
		e.preventDefault();
		$.ajax({
			url:$(this).attr('href'),
			type:'POST',
			cache: false,
			data:{'id':$(this).attr('data-id')},
			beforeSend: function(){
				toggleProgressModal(true);
			},
			success: function(data){
				setMessage(data);
				htmlScrollToTop();
				toggleProgressModal(false);
			}
		});
		return false;
	});
}

function changeUserState(){
    $('input.input-user-active-flg').change(function(){
        var url = $(this).parents('table').attr('data-href');
        var value = $(this).is(':checked')==true?1:0;
        var name = $(this).attr('data-name');
        var user = {id: $(this).parents('tr').attr('data-id')};
        user[name] = value;
        changeState(url, {user: user});
    });
}